﻿package mortal.game.proxy
{
    import Framework.Util.*;
    import Message.Game.*;
    import Message.Public.*;
    import com.gengine.debug.*;
    import extend.language.*;
    import mortal.common.error.*;
    import mortal.common.net.*;
    import mortal.game.cache.*;
    import mortal.game.manager.*;
    import mortal.game.scene3D.layer3D.utils.*;
    import mortal.game.view.copy.groupCopy.data.*;
    import mortal.game.view.copy.groupCopy.view.*;
    import mortal.game.view.group.*;
    import mortal.mvc.core.*;

    public class GroupProxy extends Proxy
    {
        private var _groupCache:GroupCache;

        public function GroupProxy()
        {
            this.init();
            return;
        }// end function

        private function init() : void
        {
            this._groupCache = this.cache.group;
            return;
        }// end function

        public function groupOper(param1:Array) : void
        {
            var _loc_2:* = param1[0];
            if (EntityUtil.isSelf(_loc_2.toEntityId))
            {
                MsgManager.showRollTipsMsg(Language.getString(30257));
                return;
            }
            rmi.iGroupPrx.groupOper_async(new AMI_IGroup_groupOper(this.operSuccess), param1);
            return;
        }// end function

        private function operSuccess(param1:AMI_IGroup_groupOper) : void
        {
            Log.debug("队伍操作成功");
            return;
        }// end function

        private function operFail(param1:Exception) : void
        {
            Log.debug("队伍操作失败");
            return;
        }// end function

        public function leftGroup(param1:GroupCopyLeaveOperData = null) : void
        {
            rmi.iGroupPrx.leftGroup_async(new AMI_IGroup_leftGroup(this.leftSuccess, this.leftFail, param1));
            return;
        }// end function

        private function leftSuccess(param1:AMI_IGroup_leftGroup) : void
        {
            var e:* = param1;
            Log.debug("离开队伍成功");
            if (e.userObject)
            {
                var clearObj:* = function (param1:Object = null) : void
            {
                Cache.instance.group.groupCopyLeaveOperData = null;
                return;
            }// end function
            ;
                Cache.instance.group.groupCopyLeaveOperData = e.userObject as GroupCopyLeaveOperData;
                CallLater.setCallLater(clearObj, 2);
            }
            return;
        }// end function

        private function leftFail(param1:Exception) : void
        {
            Log.debug("离开队伍失败");
            return;
        }// end function

        public function kickOut(param1:SEntityId) : void
        {
            rmi.iGroupPrx.kickOut_async(new AMI_IGroup_kickOut(this.kickSuccess, this.kickFail), param1);
            return;
        }// end function

        private function kickSuccess(param1:AMI_IGroup_kickOut) : void
        {
            Log.debug("踢出队伍成功");
            return;
        }// end function

        private function kickFail(param1:Exception) : void
        {
            Log.debug("踢出队伍失败");
            return;
        }// end function

        public function modifyCaptain(param1:SEntityId) : void
        {
            rmi.iGroupPrx.modifyCaptain_async(new AMI_IGroup_modifyCaptain(this.modifySuccess, this.modifyFail), param1);
            return;
        }// end function

        private function modifySuccess(param1:AMI_IGroup_modifyCaptain) : void
        {
            Log.debug("转让队长成功");
            return;
        }// end function

        private function modifyFail(param1:Exception) : void
        {
            Log.debug("转让队长失败");
            return;
        }// end function

        public function createGroup() : void
        {
            rmi.iGroupPrx.createGroup_async(new AMI_IGroup_createGroup(this.createSuccess, this.createFail));
            return;
        }// end function

        private function createSuccess(param1:AMI_IGroup_createGroup) : void
        {
            Log.debug("创建队伍成功");
            return;
        }// end function

        private function createFail(param1:Exception) : void
        {
            Log.debug("创建队伍失败");
            Log.debug(param1.code, ErrorCode.getErrorStringByCode(param1.code), param1.message);
            if (param1.code != 36104)
            {
                MsgManager.showRollTipsMsg(ErrorCode.getErrorStringByCode(param1.code));
            }
            return;
        }// end function

        public function disbandGroup() : void
        {
            rmi.iGroupPrx.disbandGroup_async(new AMI_IGroup_disbandGroup(this.disbandSuccess, this.disbandFail));
            return;
        }// end function

        private function disbandSuccess(param1:AMI_IGroup_disbandGroup) : void
        {
            Log.debug("解散队伍成功");
            return;
        }// end function

        private function disbandFail(param1:Exception) : void
        {
            Log.debug("解散队伍失败");
            return;
        }// end function

        public function getGroupInfos(param1:Array) : void
        {
            rmi.iGroupPrx.getGroupInfos_async(new AMI_IGroup_getGroupInfos(this.getInfoSucess, this.getInfoFail), param1);
            return;
        }// end function

        private function getInfoSucess(param1:AMI_IGroup_getGroupInfos) : void
        {
            Log.debug("获取附近队伍成功");
            return;
        }// end function

        private function getInfoFail(param1:Exception) : void
        {
            Log.debug("获取附近队伍失败");
            return;
        }// end function

        public function getGroupSetting(param1:Array) : void
        {
            rmi.iGroupPrx.getGroupInfos_async(new AMI_IGroup_getGroupInfos(this.getSettingSuccess, this.getSettingFail), param1);
            return;
        }// end function

        private function getSettingSuccess(param1:AMI_IGroup_getGroupInfos) : void
        {
            Log.debug("获取设置成功");
            return;
        }// end function

        private function getSettingFail(param1:Exception) : void
        {
            Log.debug("获取设置失败");
            return;
        }// end function

        public function updateGroupSetting(param1:SGroupSetting) : void
        {
            rmi.iGroupPrx.updateGroupSetting_async(new AMI_IGroup_updateGroupSetting(this.settingSuccess, this.settingbandFail, param1), param1);
            return;
        }// end function

        private function settingSuccess(param1:AMI_IGroup_updateGroupSetting) : void
        {
            var _loc_2:SGroupSetting = null;
            Log.debug("设置队伍成功");
            _loc_2 = param1.userObject as SGroupSetting;
            this._groupCache.groupName = _loc_2.name;
            this._groupCache.autoEnter = _loc_2.autoEnter;
            this._groupCache.memberInvite = _loc_2.memberInvite;
            MsgManager.showRollTipsMsg(Language.getString(30250));
            if (GroupCopySettingWin.isViewShow)
            {
                GroupCopySettingWin.instance.hide();
            }
            return;
        }// end function

        private function settingbandFail(param1:Exception) : void
        {
            Log.debug("设置队伍失败");
            MsgManager.showRollTipsMsg(ErrorCode.getErrorStringByCode(param1.code));
            return;
        }// end function

        public function getMembersPlaces() : void
        {
            rmi.iGroupPrx.getMemberPos_async(new AMI_IGroup_getMemberPos());
            return;
        }// end function

        public function groupRecruit() : void
        {
            rmi.iGroupPrx.recruit_async(new AMI_IGroup_recruit());
            return;
        }// end function

    }
}
